{% extends "base_sub.html" %}

{% block title %}我的便笺框{% endblock title %}

{% block content %}
    <div id="memo_write" class="new_win">
        <h1 id="win_title"><i class="fa fa-regular fa-envelope" aria-hidden="true"></i> 写一个便条</h1>
        <div class="new_win_con2 fs-5 pt-3">
            <!-- 开始选择消息框 { -->
            <ul class="win_ul pb-3 px-4">
                <li><a href="{{ url_for('memo_list') }}?kind=recv">收到一张纸条</a></li>
                <li><a href="{{ url_for('memo_list') }}?kind=send">已发送便笺</a></li>
                <li class="selected"><a href="{{ url_for('memo_form') }}">写一个便条</a></li>
            </ul>
            <!-- } 提示框选择结束 -->

            <form name="fmemoform" action="{{ url_for('memo_form_update') }}" onsubmit="return fmemoform_submit(this);" method="post" autocomplete="off">
                <input type="hidden" name="token" value="">
                <div class="form_01 p-4 main-bt">
                    <h2 class="blind">写一个便条</h2>
                    <ul>
                        <li>
                            <label for="me_recv_mb_id" class="blind">会员的Idy<strong>必不可少的</strong></label>
                            <input type="text" name="me_recv_mb_id" value="{{ target.mb_id }}" id="me_recv_mb_id" required="" class="frm_input full_input required alnum_" size="47" placeholder="会员的Idy">
                            <span class="frm_info">发送给多个成员时(,)请分开.</span>
                            <br><span class="frm_info">发送便笺时的成员方 {{ request.state.config.cf_memo_send_point|number_format }}我们将放弃点.</span>
                        </li>
                        <li>
                            <label for="me_memo" class="blind">内容</label>
                            <textarea name="me_memo" id="me_memo" required="" class="required">
                                {%- if memo %}
                                    {{- "----- 上一个注释内容 -------\n" ~ memo.me_memo -}}
                                {% endif -%}
                            </textarea>
                        </li>
                        <li>
                            <span class="blind">自动注册预防</span>
                            <!-- Captcha Start -->
                            <fieldset id="captcha" class="captcha">
                                {% include captcha_widget(request) ignore missing %}
                            </fieldset>
                            <!-- Captcha End -->
                        </li>
                    </ul>
                </div>

                <div class="win_btn">
                    <button type="submit" id="btn_submit" class="btn btn_b02 reply_btn fs-5">要发送</button>
                    <button type="button" onclick="window.close();" class="btn_close fs-5">窗口关闭</button>
                </div>
            </form>
        </div>
    </div>
<script>
    function fmemoform_submit(f)
    {
        f.token.value = generate_token();
        if (f.token.value == "") {
            alert("创建令牌失败.");
            return false;
        }
        // captcha 使用时
        if (typeof check_captcha === "function") {
            if (!check_captcha(f)) {
                return false;
            }
        }

        return true;
    }
</script>
{% endblock content %}